<?php get_header(); ?>
<?php global $woo_options; ?>

<?php // Reference Project Information Conversion

    $customername = get_field('RPcustomername');
    $location = get_field('RPlocation');
    $installdate = get_field('RPinstallationdate');
    $systemtype = get_field('RPsystemtype');
    $budget = get_field('RPbudget');
    $materialcost = get_field('RPmaterialcost');
    $installationcost = get_field('RPinstallationcost');
    if(get_field('RPsystemcost')) {
        $systemcost = get_field('RPsystemcost');
    } else {
        $systemcost = $materialcost + $installationcost;
    }
    $oneyrsavings = get_field('RPsavings');
        $fiveyrsavings = $oneyrsavings * 5;
    $federalincentives = get_field('RPfedincentives');
    $stateincentives = get_field('RPstateincentives');
    $paybacktime = get_field('RPpayback');
    $sspressrelease = get_field('RPsspresslink');
    $imagegallery = get_field('RPimagegallery');
?>

<style>
    .yarpp-related { display:none; }
</style>
       
    <div id="content" class="col-full">
		<div id="main" class="col-left">
		           
		<?php if ( $woo_options[ 'woo_breadcrumbs_show' ] == 'true' ) { ?>
			<?php woo_breadcrumbs(); ?> 
		<?php } ?>  

        <?php if (have_posts()) : $count = 0; ?>
        <?php while (have_posts()) : the_post(); $count++; ?>
        
			<div <?php post_class(); ?>>

				<?php echo woo_embed( 'width=580' ); ?>
                <?php if ( $woo_options[ 'woo_thumb_single' ] == "true" && !woo_embed( '')) woo_image( 'width='.$woo_options[ 'woo_single_w' ].'&height='.$woo_options[ 'woo_single_h' ].'&class=thumbnail '.$woo_options[ 'woo_thumb_single_align' ]); ?>

                <h1 class="title"><?php the_title(); ?></h1>
                <?php include '/home/silicons/public_html/wp-content/themes/woostore/page-include-social-block.php'; ?>
                
                <div class="entry">
                    
                    <div class='rpquicktop'>
                        <h3>Project Quick Reference</h3>
                        <ul>
                            <li>Customer<span><?php echo $customername ; ?></span></li>
                            <li>Location<span><?php echo $location ; ?></span></li>
                            <li>Installation Date<span><?php echo $installdate ; ?></span></li>
                            <li>Solar System Type<span><?php echo $systemtype ; ?></span></li>
                            <?php if (get_field('RPproducts')) { ?>
                            <li>Solar Product(s)
                                <span>
                                    <?php while(has_sub_field('RPproducts')) : ?>
                                        <a href='<?php the_sub_field('RPproductlink'); ?>' target='_blank'><?php the_sub_field('RPproductsku'); ?></a> 
                                    <?php endwhile ; ?>
                                </span>
                            </li>
                            <?php } ?>
                            <?php if(get_field('RPbudget')) { ?>
                                <li>Proposed Budget<span>$ <?php echo $budget ; ?></span></li>
                            <?php } ?>
                            <?php if(get_field('RPmaterialcost')) { ?>
                                <li>Solar Materials Cost<span>$ <?php echo $materialcost ; ?></span></li>
                            <?php } ?>
                            <?php if(get_field('RPinstallationcost')) { ?>
                                <li>Installation Cost<span>$ <?php echo $installationcost ; ?></span></li>
                            <?php } ?>
                            <li>Final System Cost<span>$ <?php echo $systemcost ; ?></span></li>
                            <?php if(get_field('RPsavings')) { ?>
                                <li>Est. Annual Savings<span>$ <?php echo $oneyrsavings ; ?></span></li>
                            <?php } ?>
                            <li>Est. Payback Time<span><?php echo $paybacktime ; ?> Years</span></li>
                        </ul>
                    </div>
                    
                    <div class='rpmainimage'>
                            <?php if (get_field('productFeaturedImage') != '') { ?>
                                <?php $mainimage = get_field('productFeaturedImage'); ?>
                            <?php } elseif (has_post_thumbnail( 'single-post-thumbnail' )) { ?>
                                <?php $mainimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
                            <?php } else { ?>
                                <?php $mainimage = "/../wp-content/uploads/2013/03/siliconsolar-logo.jpg"; ?>
                            <?php } ?>
                            <img src="<?php echo $mainimage; ?>" alt="<?php the_title(); ?>" width="268px" height="auto" style="margin-bottom:10px;" />
                            <p style="font-style:italic;color:#666666;text-align:center;"><?php the_title(); ?></p>
                    </div>
                    
                    <h2 class='pagesubsectionheader'>Project Overview</h2>
                    <?php the_content(); ?>
                    
                    <?php if(get_field('RPcustomsection', true)) { ?>
                        <h2 class='pagesubsectionheader'>Additional Information</h2>
                        <?php the_field('RPcustomsection'); ?>
                    <?php } ?>
                        
                    <?php if(get_field('RPtestimonial', true)) { ?>
                        <h2 class='pagesubsectionheader'>What The Customer Has To Say</h2>
                        <?php the_field('RPtestimonial'); ?>
                    <?php } ?>
                    
                    <div style="width:100%;height:0px;clear:both;"></div>
                    
                    <div class='rpleftblock'>
                        <h2 class='pagesubsectionheader'>Financial Details</h2>
                        <ul class='rpfinances'>
                            <?php if(get_field('RPbudget')) { ?>
                                <li>Proposed Budget<span>$ <?php echo $budget ; ?></span></li>
                            <?php } ?>
                            <?php if(get_field('RPmaterialcost')) { ?>
                                <li>Solar Materials Cost<span>$ <?php echo $materialcost ; ?></span></li>
                            <?php } ?>
                            <?php if(get_field('RPinstallationcost')) { ?>
                                <li>Installation Cost<span>$ <?php echo $installationcost ; ?></span></li>
                            <?php } ?>
                            <li>Total Project Cost<span>$ <?php echo $systemcost ; ?></span></li>
                            <li>Federal Incentives<span>$ <?php echo $federalincentives ; ?></span></li>
                            <li>State / Local Incentives<span>$ <?php echo $stateincentives ; ?></span></li>
                            <?php if(get_field('RPsavings')) { ?>
                                <li>Est. 1-Year Savings<span>$ <?php echo $oneyrsavings ; ?></span></li>
                                <li>Est. 5-Year Savings<span>$ <?php echo $fiveyrsavings ; ?></span></li>
                            <?php } ?>
                            <li>Calculated Payback Length<span><?php echo $paybacktime ; ?> Years</span></li>
                        </ul>
                    </div>
                    
                    <div class='rprightblock'>
                        <h2 class='pagesubsectionheader'>Press &amp; Publicity</h2>
                        <ul>
                            <?php if(get_field('RPsspresslink')) { ?>
                                <li><a href='<?php echo $sspressrelease ; ?>'>Silicon Solar Press Release</a></li>
                            <?php } ?>
                            <?php while(has_sub_field('RPproducts')) : ?>
                                <li><a href="<?php the_sub_field('RPcustprlink'); ?>" target="_blank"><?php the_sub_field('RPcustprtitle'); ?></a></li>
                            <?php endwhile; ?>
                        </ul>
                    </div>
                    
                    <h2 class='pagesubsectionheader'>Installation Images</h2>
                    
                    <?php if(get_field('RPimagegallery')) { ?>
                        <?php echo $nggshowgallery( $imagegallery ); ?>
                    <?php } else { ?>
                        <p>There are currently no additional images to display.</p>
                    <?php } ?>
                    
                </div>
                                
            </div><!-- .post -->
                                                
		<?php endwhile; else: ?>
			<div <?php post_class(); ?>>
            	<p><?php _e( 'Sorry, no posts matched your criteria.', 'woothemes' ) ?></p>
			</div><!-- .post -->             
       	<?php endif; ?>  
        
		</div><!-- #main -->

        <?php get_sidebar(); ?>

    </div><!-- #content -->
		
<?php get_footer(); ?>